﻿using System.Security.Cryptography;
using System.Text;

namespace ClothingAggregator.Utils
{
    public class EncryptionUtils
    {
        public static string EncryptString(string stringToEncrypt)
        {
            SHA256 hasher = new SHA256Managed();

            byte[] bytes = Encoding.UTF8.GetBytes(stringToEncrypt);
            byte[] hashedString = hasher.ComputeHash(bytes);

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < hashedString.Length; i++)
                sb.Append(hashedString[i].ToString("X2"));

            return sb.ToString();
        }
    }
}